import java.util.Scanner;

/**
 * @author caesar
 * @date 2025/7/1
 * @apiNote
 */
/*
 **案例需求**：
 * 假设张三从1990年1月1日开始执行三天打鱼两天晒网，5天一个周期，风雨无阻
 * 那么李四想要找张三玩，需要从键盘输入年，月，日后，判断这一天张三是在打鱼还是晒网。*/
public class homework1_7 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int[] commonYearDays = {365, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int[] leapYearDays = {366, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int totaldays = 0;
        //输入正确性校验
        int year;
        while(true){
            System.out.print("请输入年份：");
            year = input.nextInt();

            if(year >= 1990){
                break;
            }else{
                System.out.println("年份必须大于等于1990年，请重新输入");
            }
        }
        int month;
        while(true){
            System.out.print("请输入月份：");
            month = input.nextInt();

            if(month >=1 && month <= 12){
                break;
            }else{
                System.out.println("月份范围是[1,12]，请重新输入");
            }
        }
        int[] totalDays = {31,28,31,30,31,30,31,31,30,31,30,31};
        //如果第year年是闰年，那么2月份总天数是29
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            totalDays[1] = 29;
        }
        int day;
        while(true){
            System.out.print("请输入日期:");
            day = input.nextInt();
            if(day >=1 && day <= totalDays[month-1]){
                break;
            }else{
                System.out.println(year +"年" + month +"月的日期范围是[1," + totalDays[month-1] + "]，请重新输入");
            }
        }
        totaldays += day;
        for (int i = 1990; i < year; i++) {
            if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
                totaldays += leapYearDays[0];
            } else {
                totaldays += commonYearDays[0];
            }
        }

        for (int i = 1; i < month; i++) {
            if (i == 2 && (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)) {
                totaldays += leapYearDays[i];
            } else {
                totaldays += commonYearDays[i];
            }
        }

        if(totaldays%5==1 || totaldays%5==2 || totaldays%5==3){
            System.out.println("打鱼");
        }else{
            System.out.println("晒网");
        }
        input.close();
    }
}
